package cn.northsea.service.impl;

import cn.northsea.mapper.UserMapper;
import cn.northsea.pojo.User;
import cn.northsea.pojo.UserVo;
import cn.northsea.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(User user) {
        return userMapper.login(user);
    }

    @Override
    public List<UserVo> findAll(String likename, String start, String end) {
        return userMapper.findAll(likename, start, end);
    }

    @Override
    public User findUserById(Integer userId) {
        return userMapper.findUserById(userId);
    }

    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    @Override
    public User check(String userUsername) {
        return userMapper.check(userUsername);
    }

    @Override
    public void register(User user) {
        user.setCreateAt(new Date(System.currentTimeMillis()));
        userMapper.register(user);
    }

    @Override
    public void delUser(Integer[] ids) {
        userMapper.delUser(ids);
    }

    @Override
    public void huiFu(Integer userId) {
        userMapper.huiFu(userId);
    }
}
